import { Outlet, Link,useNavigate} from 'react-router-dom'
function Index() {
  const navigate=  useNavigate();
    const toReg=()=>{

        navigate("/reg")

    }
    const toNews=()=>{

       

        // navigate("/news?id=1000")
        // navigate({pathname: '/news',search:'?id=8888'})

        navigate('/news',{state:{id:8888888888}})

        

    }
    return (
        <div>
            首页

            <div>

                <Link to={'/login'}>登录</Link>
                <div onClick={()=>toReg()}>注册</div>
                <div onClick={()=>toNews()}>新闻</div>
                
            </div>

            <Outlet></Outlet>
        </div>

    )

}
export default Index;